package com.caochenlei.search;

public class OrderSearch {
    public static void main(String[] args) {
        int[] arr = {10, 20, 30, 40, 50, 60, 70, 80, 90};
        System.out.println("10的index=" + orderSearch(arr, 10));
        System.out.println("50的index=" + orderSearch(arr, 50));
        System.out.println("90的index=" + orderSearch(arr, 90));
    }

    public static int orderSearch(int[] arr, int num) {
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] == num) {
                return i;
            }
        }
        return -1;
    }
}
